package cn.cslg.action;

import cn.cslg.domain.User;
import cn.cslg.service.UserService;
import cn.cslg.service.impl.UserServiceImpl;

public class Register {

    private String username;
    private String password;
    private String name;
    private  String sex;
    private  String tel;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public String register(){
        User user = new User(username,password,name,sex,tel);
        UserService service = new UserServiceImpl();
        boolean flag = service.register(user);
        if(flag){
            return "success";
        }else{
            return "error";
        }
    }
}
